const Koa = require('koa')
const appKoa = new Koa()
const ejs = require('ejs')

const tpl = `
<!DOCTYPE html>
<html>
  <head>
    <title>JACK TEST</title>
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1">
  </head>
  <body>
    <h1>点击测试</h1>
    <p id="title"></p>
    <div id="poster"></div>
    <script src="http://zeptojs.com/zepto-docs.min.js"></script>
    <script src="http://res.wx.qq.com/open/js/jweixin-1.1.0.js"></script>
  </body>
</html>
`

appKoa.use(ctx => {
  if (ctx.url.indexOf('/visit') > -1) {
    ctx.body = ejs.render(tpl, {})
  }
})

appKoa.listen(1234)
